package com.mofang.ticketing.user.serve.merchant.dto.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mofang.ticketing.common.core.enums.merchant.MerchantTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @author LGC
 * @date 2022/5/13 17:17
 */
@Data
@ApiModel(value = "商户分页列表")
public class MerchantListPageRespDTO implements Serializable {

    private static final long serialVersionUID = -2587750286636653258L;

    @ApiModelProperty(value = "商户ID")
    private Long id;

    @ApiModelProperty(value = "商户类型 1=景区")
    private Integer merchantType;

    @ApiModelProperty(value = "商户类型 1=景区")
    private String merchantTypeStr;

    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    @ApiModelProperty(value = "管理员账号")
    private String adminAccount;

    @ApiModelProperty(value = "管理员姓名")
    private String adminUsername;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    public String getMerchantTypeStr() {
        if (merchantType != null) {
            return MerchantTypeEnum.getValueByKey(merchantType);
        }
        return merchantTypeStr;
    }
}
